build: Add support for linking with DT_RELR linking-relr
authorHauke Mehrtens <[email protected]>
Thu, 6 Nov 2025 22:08:04 +0000 (23:08 +0100)
committerHauke Mehrtens <[email protected]>
Sun, 16 Nov 2025 23:04:25 +0000 (00:04 +0100)
commit916e5e1528dcfc263dd1afad1ced17f3c73ac5a3
tree1d472bbdfacb0ce4c1ce74696995c9bccdc3ab96
parent97256a28fe9cc5e844abb697febf47c07957d6de
build: Add support for linking with DT_RELR

This adds the -Wl,-z,pack-relative-relocs linking options.
This reduces the size of some binaries.

This is only supported on i386, x86_64, aarch64 and loongarch64 in
binutils. This feature is not support for MIPS.

musl libc supports it since version 1.2.4 .
glibc supports it since vesion 2.36.
binutils ld supports it since version 2.38 for x86 and since version
2.43 for LoongArch.

This reduces the size of the armsr default root file system from
5,262,198 bytes to 5,200,950 bytes by 61,248 bytes.

Signed-off-by: Hauke Mehrtens <[email protected]>
config/Config-build.in
include/hardening.mk